package com.yls.except.util;

import java.util.Random;

import javax.servlet.http.HttpServletRequest;

public class ConstantUtil {
	public static String REGISTERCODE = "8CJh-rluQbr8_zi6kVSPgj";  //注册验证码模板id
	public static String FORGETPWDCODE = "d72EwBsYAGf8_bG6Dy3aOH"; //忘记密码验证码模板id
	public static String UPDATEPWDCODE = "7jsgN6Tu4nr9m2dzpEWBiy"; //修改密码验证码模板id
	public static String OTHERCODE = "04DdNeu8AFMa390aVN0kOt"; //通用验证码模板id
	public static String RONGKEY = "z3v5yqkbvvpq0";//替换成您的appkey
	public static String RONGSECRET = "6EMboLSR1qJmb";//替换成匹配上面key的secret

	public static final long LONGTIME = 5;  //登录超时时间（单位天）

	//初始化
	public static String APP_ID = "wxcb6d3115c0924784";//微信开发平台应用id
	public static String APP_SECRET = "9ff3fe7c67ccca7ce3591daed005b4e5";//应用对应的凭证
	//应用对应的密钥1486537382
	public static String PARTNER = "1486537382";//财付通商户号
	public static String PARTNER_KEY = "894499e7e22762aca7d411f2089c7d8b";//商户号对应的密钥
	public static String NOTIFY_URL="http://www.bbbblg.com/except/paycontroller/wechatreturn.do";

	public static String KEY = "7ZXNPcvSMXDEEtTgtAvGC6TyrJucCu8J";


	//电商ID
	public static String EBUSINESSID="1304077";
	//电商加密私钥，快递鸟提供，注意保管，不要泄漏
	public static String APPKEY="10e4805b-4326-4921-9e59-ab1ae48c718a";


	// 生成随机数字和字母,
	public static String getStringRandom(int length) {
		String val = "";
		Random random = new Random();
		// 参数length，表示生成几位随机数
		for (int i = 0; i < length; i++) {
			String charOrNum = random.nextInt(2) % 2 == 0 ? "char" : "num";
			// 输出字母还是数字
			if ("char".equalsIgnoreCase(charOrNum)) {
				// 输出是大写字母还是小写字母
				int temp = random.nextInt(2) % 2 == 0 ? 65 : 97;
				val += (char) (random.nextInt(26) + temp);
			} else if ("num".equalsIgnoreCase(charOrNum)) {
				val += String.valueOf(random.nextInt(10));
			}
		}
		System.out.println(val);
		return val;
	}
	
	public static String getrealpath (String type, HttpServletRequest req) {
		String src = "";
		if(!"".equals(type) && type != null && !"null".equals(type)) {
			src = ImgProperties.getimg(type);
		}
		String path = req.getScheme()+"://"+req.getServerName()+":"+req.getServerPort()+req.getContextPath()+"/"+src;
		return path;
	}
}
